package com.css.zfzx.sjcj.modules.hddcB2GeomorphySvyProjectTable.service.impl;

import cn.afterturn.easypoi.excel.entity.result.ExcelVerifyHandlerResult;
import cn.afterturn.easypoi.handler.inter.IExcelVerifyHandler;
import com.css.bpm.platform.utils.PlatformObjectUtils;
import com.css.zfzx.sjcj.common.excel.util.ActiveFaultEasyExcelVerifyHelper;
import com.css.zfzx.sjcj.modules.hddcB2GeomorphySvyProjectTable.viewobjects.HddcB2GeomorphysvyprojecttableVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * <p>地貌调查数据-微地貌测量工程-属性表管理, Excel导入校验器</p>
 *
 * @author liuhy
 * @date 2021/8/27
 */
@Component
public class MicroReliefMeasureEngineeringExcelVerifyHandler implements IExcelVerifyHandler<HddcB2GeomorphysvyprojecttableVO> {

    private final ActiveFaultEasyExcelVerifyHelper helper;

    @Autowired
    public MicroReliefMeasureEngineeringExcelVerifyHandler(ActiveFaultEasyExcelVerifyHelper helper) {
        this.helper = helper;
    }

    @Override
    public ExcelVerifyHandlerResult verifyHandler(HddcB2GeomorphysvyprojecttableVO vo) {
        ExcelVerifyHandlerResult result = helper.verify(vo);
        if (PlatformObjectUtils.isEmpty(vo.getLocation())) {
            helper.writeNotNullMsg(result, "测量地点");
        } else if (PlatformObjectUtils.isEmpty(vo.getCoordination())) {
            helper.writeNotNullMsg(result, "测量数据坐标系");
        } else if (PlatformObjectUtils.isEmpty(vo.getPurpose())) {
            helper.writeNotNullMsg(result, "测量目的");
        } else if (PlatformObjectUtils.isEmpty(vo.getMeasuringapparatus())) {
            helper.writeNotNullMsg(result, "测量仪器");
        } else if (PlatformObjectUtils.isEmpty(vo.getDatandirection())) {
            helper.writeNotNullMsg(result, "坐标系统假北方向");
        } else if (PlatformObjectUtils.isEmpty(vo.getMeasurer())) {
            helper.writeNotNullMsg(result, "测量者");
        } else if (PlatformObjectUtils.isEmpty(vo.getDatingsamplecount())) {
            helper.writeNotNullMsg(result, "获得测年结果样品数");
        }
        return result;
    }

}
